$().ready(function() {
	$('.summernote').summernote({
		height : '220px',
		lang : 'zh-CN',
		callbacks: {
			onImageUpload: function(files, editor, $editable) {
				console.log("onImageUpload");
				sendFile(files);
			}
		}
	});
	var bugstatus=$("#bugstatus1").val();
	set_dictinoray_list_to_select("bugstatus", null, bugstatus, "BUGSTATUS", true);//缺陷优先级

	var bugpriortity=$("#bugpriortity1").val();
	set_dictinoray_list_to_select("bugpriortity", null, bugpriortity, "BUGPRIORTITY", true);//缺陷优先级
	var bugtype=$("#bugtype1").val();
	set_dictinoray_list_to_select("bugtype", null, bugtype, "BUGTYPE", true);//缺陷类型
	var buglevel=$("#buglevel1").val();
	set_dictinoray_list_to_select("buglevel", null, buglevel, "BUGLEVEL", true);//缺陷等级




	var content = $("#bugcontent").val();
	$('#content_sn').summernote('code', content);
	//console.log(content);
	//document.getElementById("viewcontent").innerHTML = content;
	validateRule();
});

$.validator.setDefaults({
	submitHandler : function() {
		update();
	}
});
function update() {

	$("#status").val(status);

	var content_sn = $("#content_sn").summernote('code');
	$("#bugcontent").val(content_sn);
	$.ajax({
		cache : true,
		type : "POST",
		url :ctx+ "/bug/questionInfo/update",
		data : $('#signupForm').serialize(),// 你的formid
		async : false,
		error : function(request) {
			parent.layer.alert("Connection error");
		},
		success : function(data) {
			if (data.code == 0) {
				layer.msg("操作成功");


			} else {
				layer.alert(data.msg)
			}

		}
	});

}
function validateRule() {
	var icon = "<i class='fa fa-times-circle'></i> ";
	$("#signupForm").validate({
		rules : {
			name : {
				required : true
			}
		},
		messages : {
			name : {
				required : icon + "请输入名字"
			}
		}
	})
}